/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package travelexperts;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "packages", catalog = "travelexperts", schema = "")
@NamedQueries({
    @NamedQuery(name = "Packages.findAll", query = "SELECT p FROM Packages p"),
    @NamedQuery(name = "Packages.findByPackageId", query = "SELECT p FROM Packages p WHERE p.packageId = :packageId"),
    @NamedQuery(name = "Packages.findByPkgName", query = "SELECT p FROM Packages p WHERE p.pkgName = :pkgName"),
    @NamedQuery(name = "Packages.findByPkgStartDate", query = "SELECT p FROM Packages p WHERE p.pkgStartDate = :pkgStartDate"),
    @NamedQuery(name = "Packages.findByPkgEndDate", query = "SELECT p FROM Packages p WHERE p.pkgEndDate = :pkgEndDate"),
    @NamedQuery(name = "Packages.findByPkgDesc", query = "SELECT p FROM Packages p WHERE p.pkgDesc = :pkgDesc"),
    @NamedQuery(name = "Packages.findByPkgBasePrice", query = "SELECT p FROM Packages p WHERE p.pkgBasePrice = :pkgBasePrice"),
    @NamedQuery(name = "Packages.findByPkgAgencyCommission", query = "SELECT p FROM Packages p WHERE p.pkgAgencyCommission = :pkgAgencyCommission")})
public class Packages implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PackageId")
    private Integer packageId;
    @Basic(optional = false)
    @Column(name = "PkgName")
    private String pkgName;
    @Column(name = "PkgStartDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date pkgStartDate;
    @Column(name = "PkgEndDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date pkgEndDate;
    @Column(name = "PkgDesc")
    private String pkgDesc;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @Column(name = "PkgBasePrice")
    private BigDecimal pkgBasePrice;
    @Column(name = "PkgAgencyCommission")
    private BigDecimal pkgAgencyCommission;

    public Packages() {
    }

    public Packages(Integer packageId) {
        this.packageId = packageId;
    }

    public Packages(Integer packageId, String pkgName, BigDecimal pkgBasePrice) {
        this.packageId = packageId;
        this.pkgName = pkgName;
        this.pkgBasePrice = pkgBasePrice;
    }

    public Integer getPackageId() {
        return packageId;
    }

    public void setPackageId(Integer packageId) {
        Integer oldPackageId = this.packageId;
        this.packageId = packageId;
        changeSupport.firePropertyChange("packageId", oldPackageId, packageId);
    }

    public String getPkgName() {
        return pkgName;
    }

    public void setPkgName(String pkgName) {
        String oldPkgName = this.pkgName;
        this.pkgName = pkgName;
        changeSupport.firePropertyChange("pkgName", oldPkgName, pkgName);
    }

    public Date getPkgStartDate() {
        return pkgStartDate;
    }

    public void setPkgStartDate(Date pkgStartDate) {
        Date oldPkgStartDate = this.pkgStartDate;
        this.pkgStartDate = pkgStartDate;
        changeSupport.firePropertyChange("pkgStartDate", oldPkgStartDate, pkgStartDate);
    }

    public Date getPkgEndDate() {
        return pkgEndDate;
    }

    public void setPkgEndDate(Date pkgEndDate) {
        Date oldPkgEndDate = this.pkgEndDate;
        this.pkgEndDate = pkgEndDate;
        changeSupport.firePropertyChange("pkgEndDate", oldPkgEndDate, pkgEndDate);
    }

    public String getPkgDesc() {
        return pkgDesc;
    }

    public void setPkgDesc(String pkgDesc) {
        String oldPkgDesc = this.pkgDesc;
        this.pkgDesc = pkgDesc;
        changeSupport.firePropertyChange("pkgDesc", oldPkgDesc, pkgDesc);
    }

    public BigDecimal getPkgBasePrice() {
        return pkgBasePrice;
    }

    public void setPkgBasePrice(BigDecimal pkgBasePrice) {
        BigDecimal oldPkgBasePrice = this.pkgBasePrice;
        this.pkgBasePrice = pkgBasePrice;
        changeSupport.firePropertyChange("pkgBasePrice", oldPkgBasePrice, pkgBasePrice);
    }

    public BigDecimal getPkgAgencyCommission() {
        return pkgAgencyCommission;
    }

    public void setPkgAgencyCommission(BigDecimal pkgAgencyCommission) {
        BigDecimal oldPkgAgencyCommission = this.pkgAgencyCommission;
        this.pkgAgencyCommission = pkgAgencyCommission;
        changeSupport.firePropertyChange("pkgAgencyCommission", oldPkgAgencyCommission, pkgAgencyCommission);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (packageId != null ? packageId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Packages)) {
            return false;
        }
        Packages other = (Packages) object;
        if ((this.packageId == null && other.packageId != null) || (this.packageId != null && !this.packageId.equals(other.packageId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "travelexperts.Packages[ packageId=" + packageId + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
